Imports RIBS.DataAccessLayer

Namespace BusinessLogicLayer
    Public Class LetterSent

#Region "*********************************************************** Privates"
        Private _RibsID As Int32
        Private _RECORD_ID As String
        Private _LETTER_CODE As String
        Private _CURRENT_RUN_NUMBER As String
        Private _Account_SYSTEM As String
        Private _AMOUNT_DUE As String
        Private _POLICY_NUMBER As String
        Private _PRODUCT_TYPE As String
        Private _MAILING_NAME As String
        Private _MAILING_ADDRESS_1 As String
        Private _MAILING_ADDRESS_2 As String
        Private _MAILING_ADDRESS_3 As String
        Private _MAILING_SUBURB As String
        Private _MAILING_STATE As String
        Private _MAILING_COUNTRY As String
        Private _MAILING_POSTCODE As String
        Private _ADVISOR_FORENAME As String
        Private _ADVISER_SURNAME As String
        Private _ADVISER_AGENT_NUMBER As String
        Private _ADVISER_CLIENT_NUMBER As String
        Private _ADVISER_EMAIL_ADDRESS As String
        Private _ADVISER_PHONE_NUMBER As String
        Private _LETTER_DATE As String
        Private _DUE_DATE As String
        Private _EXCEPTION_IDENTIFIER As String
        Private _NEW_PREMIUM_AMOUNT As String
        Private _SUPERANNUATION_INDICATOR As String
        Private _PAYMENT_FREQUENCY As String
        Private _Retained As String
        Private _WriteOff As String
        Private _ManuallyAdded As String
        Private _UserID As String
        Private _CURRENT_PREMIUM_AMOUNT
        Private _LatestActionByEntryDate As Action
        Private _LatestActionByActionDate As Action
        Private _Actions As ActionCollection
#End Region

#Region "*********************************************************** CONSTRUCTOR "
        Public Sub New()

        End Sub
        Public Sub New(ByVal RibsID As Int32, _
                                ByVal RECORD_ID As String, _
                                ByVal LETTER_CODE As String, _
                                ByVal CURRENT_RUN_NUMBER As String, _
                                ByVal Account_SYSTEM As String, _
                                ByVal AMOUNT_DUE As String, _
                                ByVal POLICY_NUMBER As String, _
                                ByVal PRODUCT_TYPE As String, _
                                ByVal MAILING_NAME As String, _
                                ByVal MAILING_ADDRESS_1 As String, _
                                ByVal MAILING_ADDRESS_2 As String, _
                                ByVal MAILING_ADDRESS_3 As String, _
                                ByVal MAILING_SUBURB As String, _
                                ByVal MAILING_STATE As String, _
                                ByVal MAILING_COUNTRY As String, _
                                ByVal MAILING_POSTCODE As String, _
                                ByVal ADVISOR_FORENAME As String, _
                                ByVal ADVISER_SURNAME As String, _
                                ByVal ADVISER_AGENT_NUMBER As String, _
                                ByVal ADVISER_CLIENT_NUMBER As String, _
                                ByVal ADVISER_EMAIL_ADDRESS As String, _
                                ByVal ADVISER_PHONE_NUMBER As String, _
                                ByVal LETTER_DATE As String, _
                                ByVal DUE_DATE As String, _
                                ByVal EXCEPTION_IDENTIFIER As String, _
                                ByVal NEW_PREMIUM_AMOUNT As String, _
                                ByVal SUPERANNUATION_INDICATOR As String, _
                                ByVal PAYMENT_FREQUENCY As String, _
                                ByVal Retained As String, _
                                ByVal WriteOff As String, _
                                ByVal ManuallyAdded As String, _
                                ByVal UserID As String, _
                                ByVal CURRENT_PREMIUM_AMOUNT As String)
            _RibsID = RibsID
            _RECORD_ID = RECORD_ID
            _LETTER_CODE = LETTER_CODE
            _CURRENT_RUN_NUMBER = CURRENT_RUN_NUMBER
            _Account_SYSTEM = Account_SYSTEM
            _AMOUNT_DUE = AMOUNT_DUE
            _POLICY_NUMBER = POLICY_NUMBER
            _PRODUCT_TYPE = PRODUCT_TYPE
            _MAILING_NAME = MAILING_NAME
            _MAILING_ADDRESS_1 = MAILING_ADDRESS_1
            _MAILING_ADDRESS_2 = MAILING_ADDRESS_2
            _MAILING_ADDRESS_3 = MAILING_ADDRESS_3
            _MAILING_SUBURB = MAILING_SUBURB
            _MAILING_STATE = MAILING_STATE
            _MAILING_COUNTRY = MAILING_COUNTRY
            _MAILING_POSTCODE = MAILING_POSTCODE
            _ADVISOR_FORENAME = ADVISOR_FORENAME
            _ADVISER_SURNAME = ADVISER_SURNAME
            _ADVISER_AGENT_NUMBER = ADVISER_AGENT_NUMBER
            _ADVISER_CLIENT_NUMBER = ADVISER_CLIENT_NUMBER
            _ADVISER_EMAIL_ADDRESS = ADVISER_EMAIL_ADDRESS
            _ADVISER_PHONE_NUMBER = ADVISER_PHONE_NUMBER
            _LETTER_DATE = LETTER_DATE
            _DUE_DATE = DUE_DATE
            _EXCEPTION_IDENTIFIER = EXCEPTION_IDENTIFIER
            _NEW_PREMIUM_AMOUNT = NEW_PREMIUM_AMOUNT
            _SUPERANNUATION_INDICATOR = SUPERANNUATION_INDICATOR
            _PAYMENT_FREQUENCY = PAYMENT_FREQUENCY
            _Retained = Retained
            _WriteOff = WriteOff
            _ManuallyAdded = ManuallyAdded
            _UserID = UserID
            _CURRENT_PREMIUM_AMOUNT = CURRENT_PREMIUM_AMOUNT
        End Sub 'New
#End Region

#Region "*********************************************************** PROPERTIES "
        '* PROPERTIES *
        Public Property RibsID() As Int32
            Get
                If _RibsID = 0 Then
                    Return 0
                Else
                    Return _RibsID
                End If
            End Get
            Set(ByVal value As Int32)
                _RibsID = value
            End Set
        End Property

        Public Property RECORD_ID() As String
            Get
                If _RECORD_ID Is Nothing OrElse _RECORD_ID.Length = 0 Then
                    Return String.Empty
                Else
                    Return _RECORD_ID
                End If
            End Get
            Set(ByVal value As String)
                _RECORD_ID = value
            End Set
        End Property

        Public Property LETTER_CODE() As String
            Get
                If _LETTER_CODE Is Nothing OrElse _LETTER_CODE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _LETTER_CODE
                End If
            End Get
            Set(ByVal value As String)
                _LETTER_CODE = value
            End Set
        End Property

        Public Property CURRENT_RUN_NUMBER() As String
            Get
                If _CURRENT_RUN_NUMBER Is Nothing OrElse _CURRENT_RUN_NUMBER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _CURRENT_RUN_NUMBER
                End If
            End Get
            Set(ByVal value As String)
                _CURRENT_RUN_NUMBER = value
            End Set
        End Property

        Public Property Account_SYSTEM() As String
            Get
                If _Account_SYSTEM Is Nothing OrElse _Account_SYSTEM.Length = 0 Then
                    Return String.Empty
                Else
                    Return _Account_SYSTEM
                End If
            End Get
            Set(ByVal value As String)
                _Account_SYSTEM = value
            End Set
        End Property

        Public Property AMOUNT_DUE() As String
            Get
                If _AMOUNT_DUE Is Nothing OrElse _AMOUNT_DUE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _AMOUNT_DUE
                End If
            End Get
            Set(ByVal value As String)
                _AMOUNT_DUE = value
            End Set
        End Property

        Public Property POLICY_NUMBER() As String
            Get
                If _POLICY_NUMBER Is Nothing OrElse _POLICY_NUMBER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _POLICY_NUMBER
                End If
            End Get
            Set(ByVal value As String)
                _POLICY_NUMBER = value
            End Set
        End Property

        Public Property PRODUCT_TYPE() As String
            Get
                If _PRODUCT_TYPE Is Nothing OrElse _PRODUCT_TYPE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _PRODUCT_TYPE
                End If
            End Get
            Set(ByVal value As String)
                _PRODUCT_TYPE = value
            End Set
        End Property

        Public Property MAILING_NAME() As String
            Get
                If _MAILING_NAME Is Nothing OrElse _MAILING_NAME.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_NAME
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_NAME = value
            End Set
        End Property

        Public Property MAILING_ADDRESS_1() As String
            Get
                If _MAILING_ADDRESS_1 Is Nothing OrElse _MAILING_ADDRESS_1.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_ADDRESS_1
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_ADDRESS_1 = value
            End Set
        End Property

        Public Property MAILING_ADDRESS_2() As String
            Get
                If _MAILING_ADDRESS_2 Is Nothing OrElse _MAILING_ADDRESS_2.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_ADDRESS_2
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_ADDRESS_2 = value
            End Set
        End Property

        Public Property MAILING_ADDRESS_3() As String
            Get
                If _MAILING_ADDRESS_3 Is Nothing OrElse _MAILING_ADDRESS_3.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_ADDRESS_3
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_ADDRESS_3 = value
            End Set
        End Property

        Public Property MAILING_SUBURB() As String
            Get
                If _MAILING_SUBURB Is Nothing OrElse _MAILING_SUBURB.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_SUBURB
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_SUBURB = value
            End Set
        End Property

        Public Property MAILING_STATE() As String
            Get
                If _MAILING_STATE Is Nothing OrElse _MAILING_STATE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_STATE
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_STATE = value
            End Set
        End Property

        Public Property MAILING_COUNTRY() As String
            Get
                If _MAILING_COUNTRY Is Nothing OrElse _MAILING_COUNTRY.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_COUNTRY
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_COUNTRY = value
            End Set
        End Property

        Public Property MAILING_POSTCODE() As String
            Get
                If _MAILING_POSTCODE Is Nothing OrElse _MAILING_POSTCODE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _MAILING_POSTCODE
                End If
            End Get
            Set(ByVal value As String)
                _MAILING_POSTCODE = value
            End Set
        End Property

        Public Property ADVISOR_FORENAME() As String
            Get
                If _ADVISOR_FORENAME Is Nothing OrElse _ADVISOR_FORENAME.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISOR_FORENAME
                End If
            End Get
            Set(ByVal value As String)
                _ADVISOR_FORENAME = value
            End Set
        End Property

        Public Property ADVISER_SURNAME() As String
            Get
                If _ADVISER_SURNAME Is Nothing OrElse _ADVISER_SURNAME.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISER_SURNAME
                End If
            End Get
            Set(ByVal value As String)
                _ADVISER_SURNAME = value
            End Set
        End Property

        Public Property ADVISER_AGENT_NUMBER() As String
            Get
                If _ADVISER_AGENT_NUMBER Is Nothing OrElse _ADVISER_AGENT_NUMBER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISER_AGENT_NUMBER
                End If
            End Get
            Set(ByVal value As String)
                _ADVISER_AGENT_NUMBER = value
            End Set
        End Property

        Public Property ADVISER_EMAIL_ADDRESS() As String
            Get
                If _ADVISER_EMAIL_ADDRESS Is Nothing OrElse _ADVISER_EMAIL_ADDRESS.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISER_EMAIL_ADDRESS
                End If
            End Get
            Set(ByVal value As String)
                _ADVISER_EMAIL_ADDRESS = value
            End Set
        End Property

        Public Property ADVISER_CLIENT_NUMBER() As String
            Get
                If _ADVISER_CLIENT_NUMBER Is Nothing OrElse _ADVISER_CLIENT_NUMBER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISER_CLIENT_NUMBER
                End If
            End Get
            Set(ByVal value As String)
                _ADVISER_CLIENT_NUMBER = value
            End Set
        End Property

        Public Property ADVISER_PHONE_NUMBER() As String
            Get
                If _ADVISER_PHONE_NUMBER Is Nothing OrElse _ADVISER_PHONE_NUMBER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ADVISER_PHONE_NUMBER
                End If
            End Get
            Set(ByVal value As String)
                _ADVISER_PHONE_NUMBER = value
            End Set
        End Property

        Public Property LETTER_DATE() As String
            Get
                If _LETTER_DATE Is Nothing OrElse _LETTER_DATE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _LETTER_DATE
                End If
            End Get
            Set(ByVal value As String)
                _LETTER_DATE = value
            End Set
        End Property

        Public Property DUE_DATE() As String
            Get
                If _DUE_DATE Is Nothing OrElse _DUE_DATE.Length = 0 Then
                    Return String.Empty
                Else
                    Return _DUE_DATE
                End If
            End Get
            Set(ByVal value As String)
                _DUE_DATE = value
            End Set
        End Property

        Public Property EXCEPTION_IDENTIFIER() As String
            Get
                If _EXCEPTION_IDENTIFIER Is Nothing OrElse _EXCEPTION_IDENTIFIER.Length = 0 Then
                    Return String.Empty
                Else
                    Return _EXCEPTION_IDENTIFIER
                End If
            End Get
            Set(ByVal value As String)
                _EXCEPTION_IDENTIFIER = value
            End Set
        End Property

        Public Property NEW_PREMIUM_AMOUNT() As String
            Get
                If _NEW_PREMIUM_AMOUNT Is Nothing OrElse _NEW_PREMIUM_AMOUNT.Length = 0 Then
                    Return String.Empty
                Else
                    Return _NEW_PREMIUM_AMOUNT
                End If
            End Get
            Set(ByVal value As String)
                _NEW_PREMIUM_AMOUNT = value
            End Set
        End Property

        Public Property SUPERANNUATION_INDICATOR() As String
            Get
                If _SUPERANNUATION_INDICATOR Is Nothing OrElse _SUPERANNUATION_INDICATOR.Length = 0 Then
                    Return String.Empty
                Else
                    Return _SUPERANNUATION_INDICATOR
                End If
            End Get
            Set(ByVal value As String)
                _SUPERANNUATION_INDICATOR = value
            End Set
        End Property

        Public Property PAYMENT_FREQUENCY() As String
            Get
                If _PAYMENT_FREQUENCY Is Nothing OrElse _PAYMENT_FREQUENCY.Length = 0 Then
                    Return String.Empty
                Else
                    Return _PAYMENT_FREQUENCY
                End If
            End Get
            Set(ByVal value As String)
                _PAYMENT_FREQUENCY = value
            End Set
        End Property

        Public Property Retained() As String
            Get
                If _Retained Is Nothing OrElse _Retained.Length = 0 Then
                    Return String.Empty
                Else
                    Return _Retained
                End If
            End Get
            Set(ByVal value As String)
                _Retained = value
            End Set
        End Property

        Public Property WriteOff() As String
            Get
                If _WriteOff Is Nothing OrElse _WriteOff.Length = 0 Then
                    Return String.Empty
                Else
                    Return _WriteOff
                End If
            End Get
            Set(ByVal value As String)
                _WriteOff = value
            End Set
        End Property

        Public Property ManuallyAdded() As String
            Get
                If _ManuallyAdded Is Nothing OrElse _ManuallyAdded.Length = 0 Then
                    Return String.Empty
                Else
                    Return _ManuallyAdded
                End If
            End Get
            Set(ByVal value As String)
                _ManuallyAdded = value
            End Set
        End Property

        Public Property UserID() As String
            Get
                If _UserID Is Nothing OrElse _UserID.Length = 0 Then
                    Return String.Empty
                Else
                    Return _UserID
                End If
            End Get
            Set(ByVal value As String)
                _UserID = value
            End Set
        End Property

        Public Property CURRENT_PREMIUM_AMOUNT() As String
            Get
                If _CURRENT_PREMIUM_AMOUNT Is Nothing OrElse _CURRENT_PREMIUM_AMOUNT.Length = 0 Then
                    Return String.Empty
                Else
                    Return _CURRENT_PREMIUM_AMOUNT
                End If
            End Get
            Set(ByVal value As String)
                _CURRENT_PREMIUM_AMOUNT = value
            End Set
        End Property

        Public Property LatestActionByEntryDate() As Action
            Get
                If _LatestActionByEntryDate Is Nothing Then
                    Return Nothing
                Else
                    Return _LatestActionByEntryDate
                End If
            End Get
            Set(ByVal value As Action)
                _LatestActionByEntryDate = value
            End Set
        End Property

        Public Property LatestActionByActionDate() As Action
            Get
                If _LatestActionByActionDate Is Nothing Then
                    Return Nothing
                Else
                    Return _LatestActionByActionDate
                End If
            End Get
            Set(ByVal value As Action)
                _LatestActionByActionDate = value
            End Set
        End Property

        Public Property Actions() As ActionCollection
            Get
                If _Actions Is Nothing Then
                    Return Nothing
                Else
                    Return _Actions
                End If
            End Get
            Set(ByVal value As ActionCollection)
                _Actions = value
            End Set
        End Property

#End Region

#Region "*********************************************************** Methods "
        Public Shared Function GetLetterSentByID(ByVal RibsID As Int32) As LetterSentCollection
            ' validate input
            'If RibsID = String.Empty Then
            '    Throw New ArgumentOutOfRangeException("username")
            'End If
            Dim DBLayer As New DataAccess ' DataAccessLayerBaseClass = DataAccessLayerBaseClassHelper.GetDataAccessLayer()
            Return DBLayer.GetRibsItems(RibsID)
        End Function

#End Region

    End Class

End Namespace
